package com.boot.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.boot.entity.Log;
import com.boot.mapper.LogMapper;
import com.boot.service.ILogService;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;

/**
 * @author bbyh
 * @since 2024-04-29
 */
@Service
public class LogServiceImpl extends ServiceImpl<LogMapper, Log> implements ILogService {
    @Override
    public void saveInterLog(String ip, String username, String path) {
        Log log = new Log();
        log.setIp(ip);
        if (username == null) {
            log.setUsername("");
        } else {
            log.setUsername(username);
        }
        log.setPath(path);
        log.setCreateTime(LocalDateTime.now());
        save(log);
    }
}
